package com.syni.mdd.yhd.common.all.controller.protect;

import com.syni.mdd.yhd.common.all.constants.Constants;
import com.syni.mdd.yhd.common.all.constants.ResultCode;
import com.syni.mdd.yhd.common.all.constants.ResultMsg;
import com.syni.mdd.yhd.common.all.entity.BmsUserOnline;
import com.syni.mdd.yhd.common.all.entity.bo.user.CheckUserBo;
import com.syni.mdd.yhd.common.all.entity.user.BmsUser;
import com.syni.mdd.yhd.common.all.service.*;
import com.syni.mdd.yhd.common.all.utils.RequestParamUtils;
import com.syni.mdd.yhd.common.all.utils.StringUtils;
import com.syni.mdd.yhd.common.all.utils.*;
import com.syni.mdd.yhd.common.all.vo.rp.user.GetUserByMinAppVo;
import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckParams;
import com.syni.mdd.sjb.common.component.utils.common.utils.*;
import com.syni.mdd.sjb.common.component.utils.feign.service.mddDistSys.FxCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class BmsUserController {
    @Autowired
    BmsUserService bmsUserService;

    @Autowired
    BmsUserLoginLogService bmsUserLoginLogService;

    @Autowired
    BmsUserVideoLikeService bmsUserVideoLikeService;

    @Autowired
    BmsUserVideoDkService bmsUserVideoDkService;

    @Autowired
    BmsUserVideoService bmsUserVideoService;

    @Autowired
    BmsUserReportUserService bmsUserReportUserService;

    @Autowired
    BmsUserBusinessFocusService bmsUserBusinessFocusService;

    @Autowired
    BmsUserOnlineService bmsUserOnlineService;
    @Autowired
    FxCenterService fxCenterService;

    /**
     * @Description: 保存/修改定位
     * @Param: open_id
     * @Param: location_city（定位城市）
     * @Param: location_district（定位区域）
     * @return: Map
     * @Author: cfx
     * @Date: 2019/4/9
     */
    @CheckParams(checkAuth = true,params = {"location_city","location_district","latitude","longitude"})
    @PostMapping("/saveOrModifyLocation")
    public Map<String, Object> saveModLoaction(@RequestBody Map<String,Object> paramsMap){
        String userIdentify = paramsMap.get("userIdentify").toString();
        Integer userId = Integer.parseInt(userIdentify);
        BmsUser bmsUser = TokenManager.getUser(userId);
        if(bmsUser == null){
            return ResultMapHelper.result(ResultCode.CODE_USER_NO_EXIST,"用户不存在");
        }
        String locationCity = null;
        if(StringUtils.checkNullAndEmpty(paramsMap.get("location_city"))){
            locationCity = paramsMap.get("location_city").toString();
        }
        String locationDistrict = null;
        if(StringUtils.checkNullAndEmpty(paramsMap.get("location_district"))){
            locationDistrict = paramsMap.get("location_district").toString();
        }
        String latitude = null;
        if(StringUtils.checkNullAndEmpty(paramsMap.get("latitude"))){
            latitude = paramsMap.get("latitude").toString();
        }
        String longitude = null;
        if(StringUtils.checkNullAndEmpty(paramsMap.get("longitude"))){
            longitude = paramsMap.get("longitude").toString();
        }
        bmsUser = bmsUserService.addAndSaveLocation(bmsUser,locationCity,locationDistrict,latitude,longitude);
        //重新更新redis的数据
        //bmsUserOnlineService.addUserOnlineRecord(userIdentify,locationCity,locationDistrict,new Date());
        return ResultMapHelper.success(bmsUser,ResultMsg.UPDATE_SUCCESS);
    }


    @PostMapping("/online")
    public Map<String, Object> online(@RequestBody ParamsMap paramsMap){
        RequestHeaderData requestHeaderData = RequestHeaderData.getRequestHeaderData();
        CheckUserBo checkUserBo = RequestParamUtils.checkUserBo();
        //默认使用设备标识
        if(!checkUserBo.getCheckStatus().equals(ResultCode.CODE_NORMAL)){
            int client = RequestHeaderData.getRequestHeaderData().getClient();
            if(client != Constants.SMALL_PROGRAM) {
                return ResultMapHelper.success(null, ResultMsg.HAND_SUCCESS);
            }
            checkUserBo.setUserId(Constants.COMMON_FLAG_FALSE);
        }
        String userIdentify = checkUserBo.getUserId();
        String areaCode = paramsMap.getString("areaCode");
        String locationCity = paramsMap.getString("locationCity");
        String locationDistrict = paramsMap.getString("locationDistrict");
        String latitude = paramsMap.getString("latitude");
        String longitude = paramsMap.getString("longitude");
        String addr = paramsMap.getString("addr");
        String phoneModel = requestHeaderData.getString("models");
        String loginIp = requestHeaderData.getString("x-forwarded-for");
        Date nowTime = new Date();
        if(StringUtils.isBlank(areaCode)){
            bmsUserOnlineService.addUserOnlineRecord(userIdentify,locationCity,
                    locationDistrict,addr,longitude,latitude,phoneModel,loginIp,nowTime);
        }else {
            BmsUserOnline bmsUserOnline = bmsUserOnlineService.addUserOnlineRecord(userIdentify,areaCode,addr,
                    longitude,latitude,phoneModel,loginIp,nowTime);
            locationCity = bmsUserOnline.getCity();
            locationDistrict = bmsUserOnline.getDistrict();
        }
        //更新用户端数据
        BmsUser bmsUser = TokenManager.getUser(Integer.parseInt(userIdentify));
        if(bmsUser != null){
            if(StringUtils.isNotBlank(locationCity)) {
                bmsUser.setLocationCity(locationCity);
            }
            if(StringUtils.isNotBlank(locationDistrict)) {
                bmsUser.setLocationDistrict(locationDistrict);
            }
            bmsUser.setLoginTime(new Date());
            if(StringUtils.isNotBlank(latitude)) {
                bmsUser.setLatitude(latitude);
            }
            if(StringUtils.isNotBlank(longitude)) {
                bmsUser.setLongitude(longitude);
            }
            TokenManager.setUser(bmsUser);
        }
        //重新更新redis的数据
        return ResultMapHelper.success(null,ResultMsg.HAND_SUCCESS);
    }




    /**
     * @Description: 获取用户定位
     * @Param: open_id
     * @return: Map
     * @Author: cfx
     * @Date: 2019/4/8
     */
    @CheckParams(params = {"open_id"})
    @PostMapping("/getLocation")
    public Map<String, Object> getLocation(@RequestBody Map<String,Object> paramsMap){
        BmsUser bmsUser = TokenManager.getUser(paramsMap.get("open_id").toString());
        if(bmsUser == null){
            return ResultMapHelper.failure("用户不存在！");
        }
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("user_id",bmsUser.getId());
        resultMap.put("location_city",bmsUser.getLocationCity());
        resultMap.put("location_district",bmsUser.getLocationDistrict());
        resultMap.put("latitude",bmsUser.getLatitude());
        resultMap.put("longitude",bmsUser.getLongitude());
        return ResultMapHelper.success(resultMap,"获取成功");
    }

    /**
     * @Description: 获取用户信息
     * @Author: cfx
     * @Date: 2019/4/8
     */
    @PostMapping("/getUserMes")
    public Map<String,Object> getUserMes(@RequestBody Map<String,Object> paramsMap){
        String userIdentify;
        boolean isLookMe = true;
        if(paramsMap.containsKey("user_id") && StringUtils.checkNullAndEmpty(paramsMap.get("user_id"))){
            userIdentify = paramsMap.get("user_id").toString();
            isLookMe = false;
        }else {
            CheckUserBo checkUserBo = RequestParamUtils.checkUserBo();
            //默认使用设备标识
            if(!checkUserBo.getCheckStatus().equals(ResultCode.CODE_NORMAL)){
                return ResultMapHelper.result(ResultCode.USER_TOKEN_INVALID,ResultMsg.MSG_USER_TOKEN_EXPIRE);
            }
            userIdentify = checkUserBo.getUserId();
        }
        Integer userId = Integer.parseInt(userIdentify);
        BmsUser bmsUser = TokenManager.getUser(userId);
        if(bmsUser == null){
            if(!isLookMe){
                return ResultMapHelper.result(ResultCode.CODE_USER_NO_EXIST,"用户不存在");
            }
            return ResultMapHelper.result(ResultCode.USER_TOKEN_INVALID,"用户不存在");
        }
        //查询该用户获取的点赞视频数和视频数
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("likeNum",bmsUserVideoLikeService.findUserTotalLike(userId));
        resultMap.put("videoReleaseNum",bmsUserVideoService.findUserTotalRelease(userId));
        resultMap.put("dkNum",bmsUserVideoDkService.findUserTotalDk(userId));
        //获赞数
        resultMap.put("getLikeNum",bmsUserVideoLikeService.getMyGetLikeNum(userId));
        resultMap.put("myFocusBusinessNum",bmsUserBusinessFocusService.countUserFocsBusinessNum(userId));
        //是否设置手机号
        resultMap.put("isBindPhone",Constants.COMMON_FLAG_FALSE_INT);
        if(StringUtils.isNotBlank(bmsUser.getPhone())){
            resultMap.put("isBindPhone",Constants.COMMON_FLAG_TRUE_INT);
        }
        //是否设置密码
        resultMap.put("isSetPassword", Integer.parseInt(Constants.COMMON_FLAG_FALSE));
        if(bmsUser.getIsSetPwd() != null && bmsUser.getIsSetPwd() == Constants.COMMON_FLAG_TRUE_INT){
            resultMap.put("isSetPassword", Integer.parseInt(Constants.COMMON_FLAG_TRUE));
        }
        if(StringUtils.isNotBlank(bmsUser.getUnionid())){
            bmsUser.setWechatName(" ");
            if(bmsUser.getSystemUser() != null && StringUtils.isNotBlank(bmsUser.getSystemUser().getLoginName())) {
                bmsUser.setWechatName(bmsUser.getSystemUser().getLoginName());
            }
        }
        resultMap.put("fxRole",fxCenterService.getFxRole(bmsUser.getId()));
        return ResultMapHelper.success(bmsUser,resultMap,"查询成功！");
    }

    /**
     * @Description: 获取用户信息
     * @Author: cfx
     * @Date: 2019/4/8
     */
    @PostMapping("/getUserByMinApp")
    @CheckParams(checkAuth = true)
    public Map<String,Object> getUserByMinApp(@RequestBody ParamsMap paramsMap){
        Integer userIdentify = paramsMap.getInteger("userIdentify");
        BmsUser bmsUser = TokenManager.getUser(userIdentify);
        if(bmsUser == null){
            return ResultMapHelper.result(ResultCode.USER_TOKEN_INVALID,"用户不存在");
        }
        //查询该用户的头像，呢称，性别，生日
        GetUserByMinAppVo getUserByMinAppVo = new GetUserByMinAppVo();
        getUserByMinAppVo.setId(bmsUser.getId());
        getUserByMinAppVo.setHeadImgUrl(BmsUserService.getWechatHeadOrAppHeadImg(bmsUser));
        getUserByMinAppVo.setLoginName(BmsUserService.getWechatLoginName(bmsUser));
        if(bmsUser.getSystemUser() != null){
            if(bmsUser.getSystemUser().getBirthdate() != null) {
                getUserByMinAppVo.setBirthday(DateTimeUtils.converDateToString(DateTimeUtils.converLongToDate(bmsUser.getSystemUser().getBirthdate()),DateTimeUtils.DATE_PATTERN_DAY));
                if(StringUtils.isNotBlank(bmsUser.getSystemUser().getSex())){
                    if(bmsUser.getSystemUser().getSex().equals("00")){
                        getUserByMinAppVo.setSex("男性");
                    }else {
                        getUserByMinAppVo.setSex("女性");
                    }
                }
            }
        }
        if(StringUtils.isBlank(getUserByMinAppVo.getSex())){
            if(bmsUser.getSex() != null){
                getUserByMinAppVo.setSex((bmsUser.getSex() == 0) ? "女性":"男性");
            }
        }
        return ResultMapHelper.success(getUserByMinAppVo,ResultMsg.MSG_GET_SUCCESS);
    }

    /**
     * @Description: 获取用户信息
     * @Author: cfx
     * @Date: 2019/4/8
     */
    @PostMapping("/updateUserByMinApp")
    @CheckParams(checkAuth = true)
    public Map<String,Object> updateUserByMinApp(@RequestBody ParamsMap paramsMap){
        return bmsUserService.updateUserByMinApp(paramsMap);
    }


    /**
     * <pre>
     * 获取用户绑定手机号信息
     * </pre>
     */
    /*@PostMapping("/loginByPhone")
    public Map<String,Object> loginByPhone(@RequestBody ParamsMap paramsMap){
        return bmsUserService.loginByPhoneInMinApp(paramsMap);
    }*/

    @PostMapping("/thirdPartyLogin")
    @CheckParams(params = {"login_way"})
    public Map<String,Object> thirdPartyLogin(@RequestBody ParamsMap paramsMap){
        return bmsUserService.thirdPartyLogin(paramsMap);
    }

    @GetMapping("/deleteTest")
    public Map<String,Object> deleteTest(Integer userId){
        return bmsUserService.deleteTest(userId);
    }

    @PostMapping("/userBindPhone")
    @CheckParams(checkAuth = true,params = {"phone","identify_code"})
    public Map<String,Object> userBindPhone(@RequestBody Map<String,Object> paramsMap){
        String userIdentify = paramsMap.get("userIdentify").toString();
        Integer userId = Integer.parseInt(userIdentify);
        String phone = paramsMap.get("phone").toString();
        String identifyCode = paramsMap.get("identify_code").toString();
        return bmsUserService.userBindPhone(userId,phone,identifyCode);
    }

    @PostMapping("/userBindPhone/v2")
    @CheckParams(checkAuth = true,params = {"phone","identify_code"})
    public Map<String,Object> userBindPhone_v2(@RequestBody ParamsMap paramsMap){
        String userIdentify = paramsMap.get("userIdentify").toString();
        Integer userId = Integer.parseInt(userIdentify);
        String phone = paramsMap.get("phone").toString();
        String identifyCode = paramsMap.get("identify_code").toString();
        Integer loginWay = null;
        if(MapUtil.checkKeyExist(paramsMap,"loginWay")){
            loginWay = paramsMap.getInteger("loginWay");
        }
        //String unionId = paramsMap.getString("unionId");
        return bmsUserService.userBindPhone_v2(userId,phone,identifyCode,loginWay);
    }
    
    @PostMapping("/userBindWx")
    @CheckParams(checkAuth = true,params = {"unionId","openId","accessToken"})
    public Map<String,Object> userBindWx(@RequestBody Map<String,Object> paramsMap){
        System.out.println(paramsMap);
    	return bmsUserService.userBindWx(paramsMap);
    }

    @PostMapping("/userBindOperationIos")
    @CheckParams(checkAuth = true,params = {"handler"})
    public Map<String,Object> userBindOperationIos(@RequestBody ParamsMap paramsMap){
        return bmsUserService.userBindOperationIOS(paramsMap);
    }

    @PostMapping("/untyingBindWx")
    @CheckParams(checkAuth = true)
    public Map<String,Object> untyingBindWx(@RequestBody Map<String,Object> paramsMap){
    	String userIdentify = paramsMap.get("userIdentify").toString();
    	Integer userId = Integer.parseInt(userIdentify);
    	return bmsUserService.untyingBindWx(userId);
    	
    }

    @PostMapping("/userMandatoryBindPhone")
    @CheckParams(checkAuth = true,params = {"phone","identify_code"})
    public Map<String,Object> userMandatoryBindPhone(@RequestBody Map<String,Object> paramsMap){
        //获取请求参数头
        Integer userId = Integer.parseInt(paramsMap.get("userIdentify").toString());
        String phone = paramsMap.get("phone").toString();
        String identifyCode = paramsMap.get("identify_code").toString();
        Integer bindClient = null;
        if(paramsMap.containsKey("bind_client") && StringUtils.checkNullAndEmpty(paramsMap.get("bind_client"))){
            bindClient = Integer.parseInt(paramsMap.get("bind_client").toString());
        }
        return bmsUserService.mandatoryBindPhone(userId,phone,identifyCode,bindClient);
    }


    @PostMapping("/mandatoryBinding")
    @CheckParams(checkAuth = true,params = {"phone"})
    public Map<String,Object> mandatoryBinding(@RequestBody ParamsMap paramsMap){
        return bmsUserService.mandatoryBinding(paramsMap);
    }

    /**
     * @Description: 获取验证码
     * @Param: open_id
     * @return: Map
     * @Author: cfx
     * @Date: 2019/4/8
     */
    @PostMapping("/getIdentifyingCode")
    @CheckParams(params = {"phone","code_type"})
    public Map<String,Object> getIdentifyingCode(@RequestBody Map<String,Object> paramsMap){
        Map<Integer,Integer> businessClient = IdentifyCode.initBusinessClient();
        //获取参数
        String phone = paramsMap.get("phone").toString();
        if(IdentifyCode.checkPhoneIdentifySendNum(phone)){
            return ResultMapHelper.result(ResultCode.CODE_IDENTIFY_CODE_SEND_MAX_NUM,"该手机号今日验证码发送超过最大限制！");
        }
        Integer codeType = Integer.parseInt(paramsMap.get("code_type").toString());
        String code = IdentifyCode.getIdentifyCode();
        System.out.println(code);
        //异步发送短信
        String[] params = {code};
        if(BmsCommonService.checkRunProfile(BmsCommonService.RUN_PRO)){
            if(businessClient.containsKey(codeType)){
                SmsUtils.send(phone,"templateId",params,"business");
            }else {
                SmsUtils.send(phone,"templateId",params);
            }
        }
        //添加进redis
        IdentifyCode.addIdentifyCodeToRedis(phone,code,codeType);
        if(BmsCommonService.checkRunProfile(BmsCommonService.RUN_PRO)){
            return ResultMapHelper.success();
        }
        return ResultMapHelper.success(code,"获取成功");
    }

    @PostMapping("/registerLogin")
    @CheckParams(params = {"phone","login_way","login_body"})
    public Map<String,Object> registerLogin(@RequestBody Map<String,Object> paramsMap){
        //获取请求参数头d
        //RequestHeaderData requestHeaderData = new RequestHeaderData();
        int loginWay = Integer.parseInt(paramsMap.get("login_way").toString());
        String loginBody = paramsMap.get("login_body").toString();
        String phone = paramsMap.get("phone").toString();
        Integer recommendUser = null;
        if(paramsMap.containsKey("recommend_user") && StringUtils.checkNullAndEmpty(paramsMap.get("recommend_user"))){
            recommendUser = Integer.parseInt(paramsMap.get("recommend_user").toString());
        }
        Integer recommendBusiness = null;
        if(paramsMap.containsKey("recommend_business") && StringUtils.checkNullAndEmpty(paramsMap.get("recommend_business"))){
            recommendBusiness = Integer.parseInt(paramsMap.get("recommend_business").toString());
        }
        return bmsUserService.registerLoginHandle(loginWay,loginBody,phone,recommendUser,recommendBusiness);
    }

    @PostMapping("/registerLoginByThirdChannel")
    public Map<String,Object> registerLoginByThirdChannel(@RequestBody ParamsMap paramsMap){
        String phone = paramsMap.get("phone").toString();
        Integer channel = (paramsMap.getInteger("channel") == null ? Constants.THIRD_CHANNEL_ZHT : paramsMap.getInteger("channel"));
        return bmsUserService.registerLoginByThirdChannel(phone,channel);
    }


    /**
     * @Description: 记录用户登录操作
     * @Param: Map
     * @return: Map
     * @Author: cfx
     * @Date: 2019/4/8
     */
    @PostMapping("/recordUserLogin")
    @CheckParams(checkAuth = true,params = {"login_entry_type"})
    public Map<String,Object> recordUserLogin(@RequestBody Map<String,Object> paramsMap){
        String userIdentify = paramsMap.get("userIdentify").toString();
        Integer userId = Integer.parseInt(userIdentify);
        Integer loginEntryType = Integer.parseInt(paramsMap.get("login_entry_type").toString());
        String loginDistrict = "";
        if(paramsMap.containsKey("login_district") && !"".equals(paramsMap.get("login_district"))){
            loginDistrict = paramsMap.get("login_district").toString();
        }
        return bmsUserLoginLogService.recordUserLoginOp(userId,loginDistrict,loginEntryType);
    }

    @PostMapping("/checkBindPhoneByWeChart")
    @CheckParams(params = {"union_id"})
    public Map<String,Object> checkBindPhoneByWeChart(@RequestBody Map<String,Object> paramsMap){
        //获取请求参数头
        //RequestHeaderData requestHeaderData = new RequestHeaderData();
        String unionId = paramsMap.get("union_id").toString();
        return bmsUserService.checkBindPhoneByWeChart(unionId);
    }

    @PostMapping("/bindPhone")
    @CheckParams(params = {"phone","identify_code","third_cert","third_login_way"})
    public Map<String,Object> bindPhone(@RequestBody Map<String,Object> paramsMap){
        //获取请求参数头
        //RequestHeaderData requestHeaderData = new RequestHeaderData();
        String phone = paramsMap.get("phone").toString();
        String identifyCode = paramsMap.get("identify_code").toString();
        String thirdCert = paramsMap.get("third_cert").toString();
        Integer thirdLoginWay = Integer.parseInt(paramsMap.get("third_login_way").toString());
        return bmsUserService.bindUserPhone(phone,identifyCode,thirdCert,thirdLoginWay);
    }

    @PostMapping("/updateUserBase")
    @CheckParams(checkAuth = true,params = {"login_name","head_img"})
    public Map<String,Object> updateUser(@RequestBody Map<String,Object> paramsMap){
        String userIdentify = paramsMap.get("userIdentify").toString();
        String loginName = paramsMap.get("login_name").toString();
        String headImg = paramsMap.get("head_img").toString();
        return bmsUserService.updateUserBaseInfo(Integer.parseInt(userIdentify),loginName,headImg);
    }

    @PostMapping("/updateUserMain")
    @CheckParams(checkAuth = true)
    public Map<String,Object> updateUserMain(@RequestBody ParamsMap paramsMap){
        String userIdentify = paramsMap.get("userIdentify").toString();
        String loginName = paramsMap.getString("login_name");
        Integer sex = paramsMap.getInteger("sex");
        String headImg = paramsMap.getString("head_img");
        String birthDay = paramsMap.getString("birth_day");
        return bmsUserService.updateUserMainInfo(Integer.parseInt(userIdentify),loginName,sex,headImg,birthDay);
    }

    @PostMapping("/updateUserHeadImg")
    @CheckParams(checkAuth = true,params = {"head_img"})
    public Map<String,Object> updateUserHeadImg(@RequestBody Map<String,Object> paramsMap){
        String userIdentify = paramsMap.get("userIdentify").toString();
        String headImg = paramsMap.get("head_img").toString();
        return bmsUserService.updateUserHeadImg(Integer.parseInt(userIdentify),headImg);
    }

    @PostMapping("/updateUserPassword")
    @CheckParams(checkAuth = true,params = {"password","identify_code"})
    public Map<String,Object> updateUserPassword(@RequestBody Map<String,Object> paramsMap){
        String userIdentify = paramsMap.get("userIdentify").toString();
        String identifyCode = paramsMap.get("identify_code").toString();
        String password = paramsMap.get("password").toString();
        return bmsUserService.updateUserPassword(Integer.parseInt(userIdentify),identifyCode,password);
    }

    @PostMapping("/myFocusBusiness")
    @CheckParams(checkAuth = true,params = {"page_num","page_size"})
    public Map<String,Object> myFocusBusiness(@RequestBody Map<String,Object> paramsMap){
        Integer userId = Integer.parseInt(paramsMap.get("userIdentify").toString());
        Integer pageNum = Integer.parseInt(paramsMap.get("page_num").toString());
        Integer pageSize = Integer.parseInt(paramsMap.get("page_size").toString());
        return bmsUserService.getMyFocusBusiness(userId,pageNum,pageSize);
    }

    /**
     * @Description 用户对用户进行举报
     * @Author: cfx
     * @Date: 2019/7/4
     */
    @PostMapping("/reportUser")
    @CheckParams(checkAuth = true,params = {"user_id","report_type"})
    public Map<String,Object> reportUser(@RequestBody Map<String,Object> paramsMap){
        Integer userId = Integer.parseInt(paramsMap.get("userIdentify").toString());
        Integer reportedId = Integer.parseInt(paramsMap.get("user_id").toString());
        Integer reportType = Integer.parseInt(paramsMap.get("report_type").toString());
        String reportContent = "";
        if(paramsMap.containsKey("report_content") && StringUtils.checkNullAndEmpty(paramsMap.get("report_content"))){
            reportContent = paramsMap.get("report_content").toString();
            if(reportContent.length() > Constants.MAX_CONTENT_LENG){
                return ResultMapHelper.result(ResultCode.CODE_BUSINESS_REPORT_ERROR_LONG,"举报内容过长");
            }
        }
        return bmsUserReportUserService.reportUser(userId,reportedId,reportType,reportContent);
    }

    /**
     * @Description 登录成功后查看与视频的动态
     * @Author: cfx
     * @Date: 2019/7/9
     *
     */
    @PostMapping("/watchVideoInteractive")
    @CheckParams(checkAuth = true,params = {"video_ids"})
    public Map<String,Object> watchVideoInteractive(@RequestBody Map<String,Object> paramsMap){
        Integer userId = Integer.parseInt(paramsMap.get("userIdentify").toString());
        List<Integer> videoIds = (List) paramsMap.get("video_ids");
        return bmsUserService.watchVideoInteractive(userId,videoIds);
    }



    @PostMapping("/testToken")
    public Map<String,Object> testToken(@RequestBody Map<String,Object> paramsMap){
        //获取请求参数头
        //RequestHeaderData requestHeaderData = new RequestHeaderData();
        String token = paramsMap.get("token").toString();
        int checkStatus = TokenUtils.checkToken(token,"217");
        if(checkStatus == TokenUtils.TOKEN_SUCCESS){
            System.out.println("验证成功!");
        }
        return null;
    }
}
